# Create your views here.
from django.shortcuts import render_to_response
from django.newforms.util import ErrorList

from xul import imap

def index(request):
    return render_to_response('login.html')

def login(request):
    mboxes, messages = imap.login_user(request)
    
    if mboxes:
        resp = render_to_response("mail.xul", {'mboxes': mboxes, 'messages': messages})
        resp["Content-Type"] = "application/vnd.mozilla.xul+xml"
        return resp
    else:
        return render_to_response("login.html")
